﻿package gamestates
{
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author Georg Kamptner
	 */
	public class GameStateModifyBodies implements IGameState
	{
		private var _game:Game;	
		
		public function GameStateModifyBodies(game:Game) 
		{
			_game = game;
		}
		
		public function init():void
		{
			_game.logStatus("Drag n Drop - Mode");
			_game.enableDragAndDrop();
		}
		
		public function onMouseUp(e:MouseEvent):void {}
		public function changeStateToSettingsScreen():void{}
		public function changeStateToStartScreen():void
		{
			_game.resetGameWorld();
			_game.hideInGameView();
			_game.state = _game.getGameState(Game.START_SCREEN);
			_game.state.init();
		}
		
		public function changeStateToGameSelection():void
		{
			// no we don`t want that to happen.
		}
		public function changeStateToIntroScreen():void{}
		public function changeStateToDefault():void
		{
			_game.disableDragAndDrop();
			
			// change to new state
			_game.state = _game.getGameState(Game.DEFAULT);
			_game.state.init();
		}
		
		public function changeStateToAddBody():void
		{
			_game.disableDragAndDrop();
			
			// change to new state
			_game.state = _game.getGameState(Game.ADD_BODY);
			_game.state.init();
		}
		
		public function changeStateToModifyBodies():void {}
		
		public function swapPlayers():void
		{
			_game.disableDragAndDrop(); // disable drag n drop for the old player
			_game.swapPlayers();
		}
		
		public function quit():void 
		{
			_game.changeStateToStartScreen();
		}
		
		public function onPlayerWon(player:Player):void
		{
			changeStateToDefault();
			_game.onPlayerWon(player);
			
			_game.logStatus("PLAYER '" + player.name + "' WON!");
		}
		
	}
	
}